import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //定义文本样式

    return Scaffold(
      appBar: AppBar(
        title: Text("Button"),
      ),
      //设定子元素的长宽
      /*body: SizedBox(
          height: 400,
          width: 200,
          child: Container(
            color: Colors.blue,
          ),
        )*/
        body: ConstrainedBox(
          //constraints: BoxConstraints.expand(), //填充所有剩余空间
          constraints: BoxConstraints(  //自定义宽高
            //minWidth: 100,
            minWidth: double.infinity,//最小宽度无限大, 横向填满
            minHeight: 200,
            //maxWidth: 200,
            maxHeight: 300
          ),
          child: Container(
            color:Colors.yellow
          ),
        )
    );
  }

}
